package com.aplink.generic.constant.type;

public enum ActionType {

	AUTO_SYNC(0xF10020, "AutoSync", true),
	CHANGE_LANGUAGE(0xF10036, "ChangeLanguage"),
	CHANGE_PASSWORD(0xF10020, "ChangePassword"),
	CHECK_EXISTS(0xF10016, "CheckExists"),
	CLEAR_FORM(0xF10021, "ClearAll"),
	CLOSE(0xF10018, "Close"),
	DELETE(0xF10007, "Delete"),
	DOWNLOAD(0xF10003, "Download", true),
	DOWNLOAD_ALL(0xF10017, "DownloadAll", true),
	FORGOT_PASSWORD(0xF10019, "ForgotPassword"),
	GET_DIRECTION(0xF10034, "GetDirection"),
	INIT_DATA(0xF10002, "InitData", true),
	INSERT(0xF10005, "Insert"),
	LOGIN(0xF10001, "Login"),
	LOGIN_OFFLINE(0xF10012, "LoginOffline"),
	LOGOUT(0xF10011, "Logout"),
	NEXT_PAGE(0xF10008, "NextPage"),
	OFFLINE_MODE(0xF10010, "OfflineMode"),
	REFRESH_PAGE(0xF10015, "RefreshPage"),
	RESET_APPLICATION(0xF10009, "ResetApplication"),
	SAVE(0xF10013, "Save"),
	UPDATE(0xF10006, "Update"),
	UPDATE_LOCATION(0xF10035, "UpdateLocation", true),
	UPLOAD(0xF10004, "Upload", true);
	
	public static ActionType get(final int code) {
		for (final ActionType actionType : ActionType.values()) {
			if (actionType.getCode() == code) {
				return actionType;
			}
		}
		return null;
	}
	public static ActionType get(final String value) {
		for (final ActionType actionType : ActionType.values()) {
			if (actionType.getValue().equalsIgnoreCase(value)) {
				return actionType;
			}
		}
		return null;
	}
	private boolean isIgnoreWebservice;

	private int mCode;

	private String mValue;

	private ActionType(final int code, final String value) {
		this.mCode = code;
		this.mValue = value;
		isIgnoreWebservice = false;
	}

	private ActionType(final int code, final String value,
	        boolean isIgnoreWebservice) {
		this.mCode = code;
		this.mValue = value;
		this.isIgnoreWebservice = isIgnoreWebservice;
	}

	public int getCode() {
		return this.mCode;
	}

	public String getValue() {
		return this.mValue;
	}

	public boolean isIgnoreWebservice() {
		return isIgnoreWebservice;
	}

	public void setIgnoreWebservice(boolean isIgnoreWebservice) {
		this.isIgnoreWebservice = isIgnoreWebservice;
	}
}
